package com.zrrd.mcl.webll.controller;

import com.zrrd.mcl.common.result.Result;
import com.zrrd.mcl.item.client.ItemFeiginClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Map;

@Controller
public class WebItemController {

    @Autowired
    private ItemFeiginClient itemFeiginClient;

    @GetMapping("/{skuId}.html")
    public String getItem(@PathVariable("skuId") Long skuId, Model model) {
        Result<Map> result = itemFeiginClient.getItem(skuId);
        model.addAllAttributes(result.getData());
        return "/item/index";

    }

}
